﻿@page "{id:int}"
@using RazorPagesWebSite

@functions
{
    [ModelBinder]
    public UserModel UserModel { get; set; }

    [FromRoute]
    public int Id { get; set; }

    public void OnPost(UserModel user)
    {
        Valid = TryValidateModel(user);

        UserModel = user;
    }

    public bool Valid { get; set; }
}

@Html.ValidationSummary()
<form action="">
    @Html.AntiForgeryToken()
</form>
Validation: @(Valid ? "success" : "fail!" )
